package com.accenture.adf.newcodington.module16.activity;

import org.junit.Test;


import junit.framework.TestCase;

/**
 * Topic : Unit Testing
 * 
 * Description:
 * 
 * The TestTemperature class is used test the workflow conditions of the Temperature domain class.
 * This file is the solution file for the Junit See It task.
 * 
 */
public class TestTemperature extends TestCase {

	// Local object of Temparature class
	Temperature temperature;

	protected void setUp() throws Exception {
		super.setUp();

	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	@Test
	/**
	 * TCS.UT.AP331.TC.001: Passed no parameters - Default values set for
	 * all attributes
	 */
	public void testTemperature() {
	
		temperature = new Temperature();

		// Confirm default values are set.
		assertEquals(32.0f, temperature.getTemperature());
		assertEquals('F', temperature.getCurrUOM());
		assertEquals('C', temperature.getNewUOM());
	}
	@Test
	/**
	 * TCS.UT.AP331.TC.002: Passed two parameters - Confirm default value
	 *	for newUOM
	 */
	public void testTemperatureFloatChar_TempInCelsius() {
 
		temperature = new Temperature(100, 'C');
		assertEquals(100.0f, temperature.getTemperature());
		assertEquals('C', temperature.getCurrUOM());
		assertEquals('K', temperature.getNewUOM());
	}
	@Test
	/**
	 * TCS.UT.AP331.TC.003: Passed two parameters - Confirm default value
	 * for newUOM
	 */
	public void testTemperatureFloatChar_TempinFahrenheit() {

		temperature = new Temperature(212, 'F');
		assertEquals(212.0f, temperature.getTemperature());
		assertEquals('F', temperature.getCurrUOM());
		assertEquals('C', temperature.getNewUOM());
	}
	@Test
	/**
	 *  TCS.UT.AP331.TC.004: Passed two parameters - Confirm default value
	 *  for newUOM
	 */
	public void testTemperatureFloatChar_TempinKelvin() {

		temperature = new Temperature(100, 'K');
		assertEquals(100.0f, temperature.getTemperature());
		assertEquals('K', temperature.getCurrUOM());
		assertEquals('C', temperature.getNewUOM());

	}
	@Test
	/**
	 * TCS.UT.AP331.TC.006: Passed three parameters - All values populated
	 * correctly
	 */
	public void testTemperatureFloatCharChar() {

		temperature = new Temperature(100, 'F', 'K');
		assertEquals(100.0f, temperature.getTemperature());
		assertEquals('F', temperature.getCurrUOM());
		assertEquals('K', temperature.getNewUOM());
	}

}
